package com.hbnu.xiadongyu;
//编写测试类，使⽤多态⽅式创建不同员⼯对象并计算奖⾦。
class Employee {
    private String name;
    private double salary;
    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }
    public double calculateBonus() {//计算奖金
        return salary * 0.1;
    }
}
class Manager extends Employee {
    public Manager(String name, double salary) {
        super(name, salary);
    }
    @Override
    public double calculateBonus() {
        return super.calculateBonus() + 1000;
    }
}
class Developer extends Employee {
    public Developer(String name, double salary) {
        super(name, salary);
    }
    @Override
    public double calculateBonus() {
        return super.calculateBonus() + 500;
    }
}
class experimen{
    public static void main(String[] args) {
        Manager manager=new Manager("张三",8000);
        System.out.println("奖金："+manager.calculateBonus());
        Developer developer=new Developer("李四",4000);
        System.out.println("奖金："+developer.calculateBonus());
    }
}